<?php
	
	require ("PHP/config/main.conf.php");
	
	$template = new HTML('__chooseProduct');
	$headerFooter = new HF();
	$template -> set_var("HEADER", $headerFooter -> buildHeader());
	$template -> set_var("FOOTER", $headerFooter -> buildFooter());
	
	//左边显示商品分类
	$typeOfProduct = Model::getAllType();
	$documentTypeOfPoduct = "";
	foreach($typeOfProduct as $docTypeOfProduct)
	{
		$oneType = new HTML('__oneLinkOfType');
		$oneType -> set_var("ID",$docTypeOfProduct['id']);
		$oneType -> set_var("NAME",$docTypeOfProduct['name']);
		$oneType -> set_var("VOLUME",$docTypeOfProduct['volume']);
		
		$documentTypeOfPoduct .= $oneType -> gen();
	}
	$template -> set_var("LEFT",$documentTypeOfPoduct);
	
	
	
	
	// 中间显示部分
	$template -> set_var("TITLE","List of Products");
	$nameOfProduct = Model::getAllProduct();
	$documentListOfProduct = '';
	foreach($nameOfProduct as $docNameOfProduct)
	{
		$oneProduct = new HTML('__oneProduct');
		$oneProduct -> set_var("PRODUCT_NAME",$docNameOfProduct['name']);
		$oneProduct -> set_var("PRICE",$docNameOfProduct['price']);
		$oneProduct -> set_var("ID",$docNameOfProduct['id']);
		$documentListOfProduct .= $oneProduct -> gen();
	}
	$template -> set_var("TEMPLATE",$documentListOfProduct);
	
	echo $template -> gen();



?>